package model.librairie;

import java.util.*; 

public abstract class Article {

    protected int id_article;
    protected String nom;
    protected String resume;
    protected Date dateAjout;
    protected Date dateDerniereModif;
    protected double note;    
    protected int nbNotes;
    protected char type;
    protected String url;

    private Set<CommentaireArticle> listeCommentArt = new HashSet<CommentaireArticle>(0);
    private Set<Collection> listePossArticles = new HashSet<Collection>(0);
    
    public Article () {
    }



    public void noter(int note) {
        this.note = ((this.note*this.nbNotes)+note) / (this.nbNotes+1);
        this.nbNotes++;        
    }
    
    public void ajouterCommentaire(CommentaireArticle com){
    	listeCommentArt.add(com);
    }

    public void signaler () {
    }

	public int getId_article() {
		return id_article;
	}

	public void setId_article(int id_article) {
		this.id_article = id_article;
	}

	public String getNom() {
		return nom;
	}

	public void setNom(String nom) {
		this.nom = nom;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}	
	
	public String getResume() {
		return resume;
	}

	public void setResume(String resume) {
		this.resume = resume;
	}

	public Date getDateAjout() {
		return dateAjout;
	}

	public void setDateAjout(Date dateAjout) {
		this.dateAjout = dateAjout;
	}

	public Date getDateDerniereModif() {
		return dateDerniereModif;
	}

	public void setDateDerniereModif(Date dateDerniereModif) {
		this.dateDerniereModif = dateDerniereModif;
	}

	public double getNote() {
		return note;
	}

	public void setNote(double note) {
		this.note = note;
	}

	public char getType() {
		return type;
	}

	public void setType(char type) {
		this.type = type;
	}

	public Set<CommentaireArticle> getListeCommentArt() {
		return listeCommentArt;
	}

	public void setListeCommentArt(Set<CommentaireArticle> listeCommentArt) {
		this.listeCommentArt = listeCommentArt;
	}    

	public Set<Collection> getListePossArticles() {
		return listePossArticles;
	}

	public void setListePossArticles(Set<Collection> listePossArticles) {
		this.listePossArticles = listePossArticles;
	}	

}

